//
//  PhoneNumberViewController.m
//  CarTown
//
//  Created by 熊浩 on 15/9/3.
//  Copyright (c) 2015年 熊浩. All rights reserved.
//

#import "PhoneNumberViewController.h"

@interface PhoneNumberViewController ()
@property (weak, nonatomic) IBOutlet UITextField *phonenumber;
@property (weak, nonatomic) IBOutlet UIButton *bindbtn;

@end

@implementation PhoneNumberViewController

- (IBAction)unbindclick:(id)sender {
}

+(instancetype)Viewcontroller{
    PhoneNumberViewController *pvc=[[PhoneNumberViewController alloc]initWithNibName:NSStringFromClass([self class]) bundle:nil];
    return pvc;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    if (_block) {
        self.navigationItem.title=@"绑定手机";
        self.navigationItem.rightBarButtonItem=[[UIBarButtonItem alloc]initWithTitle:@"确认" style:UIBarButtonItemStyleDone target:self action:@selector(rightclick)];
        self.phonenumber.enabled=YES;
        self.bindbtn.hidden=YES;
    }else{
        self.navigationItem.title=@"解除绑定";
        self.phonenumber.enabled=NO;
        self.bindbtn.hidden=NO;
        
    }
    self.phonenumber.text=self.phonetext;
}
-(void)rightclick{
    if (_block&&self.phonenumber.text.length>0) {
        _block(self.phonenumber.text);
    }
    [self.navigationController popViewControllerAnimated:YES];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
